﻿@model Guardian.Domain.QueryListResult<Guardian.Domain.FirewallRule.FirewallRuleDto>
@{
    ViewData["Title"] = "Waf Rules";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<div class="text-center">
    <h1 class="display-4">Firewall Rules</h1>
    <hr />
    <div>
        <a class="btn btn-primary" asp-area="" asp-controller="FirewallRules" asp-action="Create" asp-route-id="@ViewBag.TargetId">Create</a>
    </div>
    <br />
    @if (Model.IsSucceeded && Model.Count > 0)
    {
        <table class="table">
            <thead>
                <tr>
                    <th>
                        Title
                    </th>
                    <th>
                        Rule For
                    </th>
                    <th>
                        Active
                    </th>
                    <th>
                    </th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model.Result)
                {
                <tr>
                    <td>
                        @item.Title
                    </td>
                    <td>
                        @item.RuleFor.ToString()
                    </td>
                    <td>
                        @item.IsActive
                    </td>
                    <td>
                        <form asp-controller="/FirewallRules" asp-action="Delete" asp-route-id="@item.Id">
                            @Html.Hidden("ruleId", item.Id)
                            <a class="btn btn-sm btn-info" asp-action="Update" asp-route-id="@item.Id">Edit</a>
                            <button class="btn btn-sm btn-danger">Delete</button>
                        </form>
                    </td>
                </tr>
                }
            </tbody>
        </table>

    }

</div>